package com.game.worm.mobile.view.discovery.tools;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.dx.as.ToolBarOptions;
import com.dx.as.UI;
import com.game.worm.mobile.R;
import com.game.worm.mobile.bean.GameBean;
import com.game.worm.mobile.view.discovery.tools.adpater.ToolsAdpater;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by d_xxiang on 2018/4/7.
 */

public class ToolsActivity extends UI{
    private ToolsAdpater adpater;
    @Override
    protected void onActivityCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_tools);
        initToolbar();
        initView();

    }

    private void initToolbar(){
        ToolBarOptions toolBarOptions = new ToolBarOptions();
        toolBarOptions.showLeftImg = true;
        toolBarOptions.titleId = R.string.game_tools;
        setToolbar(toolBarOptions);
    }

    private void initView(){
        RecyclerView recyclerView = findView(R.id.recyclerview);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(linearLayoutManager);

        adpater = new ToolsAdpater(this);
        recyclerView.setAdapter(adpater);
        getTestData();
    }

    private void getTestData(){
        List<GameBean> list = new ArrayList<>();
        for (int i = 0; i < 5; i ++) {
            list.add(new GameBean());
        }
        adpater.addData(list);
        adpater.notifyDataSetChanged();
    }
}
